package com.topisv.tms.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.topisv.tms.entity.TaskNumber;
import com.topisv.tms.repository.TaskNumberDao;

//Spring Bean的标识.
@Component
// 默认将类中的所有public函数纳入事务管理.
@Transactional(readOnly = true)
public class TaskNumberService {

	@Autowired
	private TaskNumberDao taskNumberDao;
	
	public List<TaskNumber> findAll(){
		return (List<TaskNumber>) taskNumberDao.findAll();
	}
	
	public TaskNumber findByTypeAndCustomerCode(String type,String customerCode){
		return taskNumberDao.findByTypeAndCustomerCode(type,customerCode);
	}
	@Transactional(readOnly = false)
	public TaskNumber save(TaskNumber arg0){
		return taskNumberDao.save(arg0);
	}
	@Transactional(readOnly = false)
	public List<TaskNumber> save(List<TaskNumber> arg0){
		return (List<TaskNumber>) taskNumberDao.save(arg0);
	}
}
